package pers.rcl.web;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import pers.rcl.common.routes.ControllerBind;
import pers.rcl.constant.PageConstant;
import pers.rcl.utils.PageData;

@ControllerBind(path = "/Item")
public class ItemDataController extends Controller {
	public void page() {
		render("/WEB-INF/views/items/item_list.html");
	}

	public void seeItems() {
		int pageNumber = getParaToInt(PageConstant.PAGENUM, 1);
		int pageSize = getParaToInt(PageConstant.PAGESIZE, 10);
		Page<Record> page = Db.paginate(pageNumber, pageSize, Db.getSqlPara("sys.item.findItemsGrid"));
		renderJson(new PageData<>(page));
	}
}
